<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"
    import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>我的預借記錄</title>
</head>
 
<body>
<% if(session.getAttribute("access") == "y" ){%>
<jsp:useBean id="mydb" scope="page" class="bean.ConDbBean"/> <%//連結資料庫的bean %>

<jsp:useBean id="member" scope="page" class="myclass.Member"/>
<table width="750" border="0" align="center">
  <tr>
    <td width="30" rowspan="4"><jsp:include page="../frameset/left.jsp" flush="true" ></jsp:include></td>
    <td colspan="2"><jsp:include page="../frameset/top.jsp" flush="true" ></jsp:include></td>
    <td width="40" rowspan="4"><jsp:include page="../frameset/right.jsp" flush="true" ></jsp:include></td>
  </tr>
  <tr>
    <td rowspan="2"><jsp:include page="../frameset/mean.jsp" flush="true" ></jsp:include>

    </td>
    <td height="32"><jsp:include page="../frameset/book_mean.jsp" flush="true" ></jsp:include></td>
  </tr>
  <tr>
    <td>
    <%--內頁--%>
    <table width="550" border="0">
  <tr>
    <td colspan="2" bgcolor="#6699FF"><div align="center">時段表說明</div></td>
  </tr>
  <tr>
    <td bgcolor="#FFCC66"><div align="center">時段</div></td>
    <td bgcolor="#FFCC66"><div align="center">說明</div></td>
  </tr>
  <tr>
    <td bgcolor="#FF9966"><div align="center">時段a</div></td>
    <td bgcolor="#FF9966"><div align="center">上午</div></td>
  </tr>
  <tr>
    <td bgcolor="#FF9966"><div align="center">時段b</div></td>
    <td bgcolor="#FF9966"><div align="center">中午</div></td>
  </tr>
  <tr>
    <td bgcolor="#FF9966"><div align="center">時段c</div></td>
    <td bgcolor="#FF9966"><div align="center">下午</div></td>
  </tr>
    <tr>
    <td bgcolor="#FF9966"><div align="center">時段d</div></td>
    <td bgcolor="#FF9966"><div align="center">晚上</div></td>
  </tr>
</table>
    <%
    String sql="";
    ResultSet rs;
    sql="select * from BOOK WHERE M_ID='"+session.getAttribute("accessid")+"'";
	rs=mydb.executeQuery(sql);
	if(rs.next()){%>
	<form id="form1" name="form1" method="post" action="do_delBook.jsp">
	<table width="550" border="1">
  		<tr bgcolor="#6699FF">
    		<td>預借者</td>
   			<td>場地/設備編號</td>
   			<td>預借理由</td>
    		<td>預借日期</td>
    		<td>預借時段</td>
    		<td><input type="submit" name="Submit" value="刪除" /></td>
  		</tr>
  		
  			
    			
    				
    					
    					<%
  							do{
  		 						member.setMember(rs.getString("M_ID"));
  		 				%>
    						<tr>
    							<td><%=member.getName()%></td>
    							<td><%=rs.getString("PF_ID")%></td>
    							<td><%=rs.getString("BOOK_REASON")%></td>
    							<td><%=(rs.getString("APPLY_DATE")).substring(0,10)%></td>
    							<td><%=rs.getString("BOOK_TIME")%></td>
    							<td><input name="del" type="checkbox" value="<%=rs.getString("BOOK_ID")%>" />
    						</tr>
    						<%
  							}while(rs.next());
  		 					%>
    					
    				
    			
  			
  		
	</table>
    </form>
	<%
	}else{
		out.print("您沒有預借的資料");
	}
	%>
	
<%--內頁end--%>
    </td>
  </tr>
  <tr>
    <td colspan="2"></td>
  </tr>
</table>
<%
  }
  else{
  	response.sendRedirect("../index.jsp"); //若沒有登入則回到index.jsp
  } 
  %>
</body>
</html>
